package com.zz.common.cassandra

import akka.actor._
import io.getquill.{CassandraAsyncContext, SnakeCase}

object CassandraExtension extends ExtensionId[CassandraExtension] with ExtensionIdProvider {

 override def lookup(): CassandraExtension.type = CassandraExtension

 override def createExtension(system: ExtendedActorSystem) = new CassandraExtension(system)

 override def get(system: ActorSystem): CassandraExtension = super.get(system)
}

class CassandraExtension(system: ExtendedActorSystem) extends Extension {

  val cassandra: CassandraConfig = CassandraConfig(system.settings.config)

  val ctxW: CassandraAsyncContext[SnakeCase] = cassandra.ctxW

  val ctxR: CassandraAsyncContext[SnakeCase] = cassandra.ctxR

}
